local zeshi = fk.CreateSkill {
  name = "lvshi__zeshi",
  tags = { Skill.Limited }
}

Fk:loadTranslationTable{
  ["lvshi__zeshi"] = "择势",
  ["lvshi__zeshi_throw"] = "获得“乱武”，令%src弃置四张手牌",
  ["lvshi__zeshi_recover"] = "获得“间书”，令%src回复2点体力",
  [":lvshi__zeshi"] = "限定技，当一名角色进入濒死状态时。你可选择一项：令其弃置四张手牌，然后你获得“乱武”；或令其回复2点体力，然后你获得“间书”。",
  ["$lvshi__zeshi1"] = "孤立川上，观逝者如东去之流水。",
  ["$lvshi__zeshi2"] = "九州如画，怎可空老人间？",
}

zeshi:addEffect(fk.EnterDying,{
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(zeshi.name) and player:usedSkillTimes(zeshi.name, Player.HistoryGame) == 0
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local choices = {"lvshi__zeshi_throw:"..target.id, "lvshi__zeshi_recover:"..target.id}
    local choice = room:askToChoice(player, {choices = choices, skill_name = zeshi.name})
    if choice == choices[1] then
      room:askToDiscard(target, {
        min_num = math.min(target:getHandcardNum(), 4),
        max_num = 4,
        include_equip = false,
        skill_name = zeshi.name,
        cancelable = false,
      })
      room:handleAddLoseSkills(player, "lvshi__luanwu")
    else
      room:recover{who = target, num = 2, recoverBy = player, skillName = zeshi.name}
      room:handleAddLoseSkills(player, "lvshi__jianshu")
    end
  end,
})


return zeshi